package com.qianji.petmall.search.controller;

import com.qianji.petmall.search.service.MallSearchService;
import com.qianji.petmall.search.vo.SearchParam;
import com.qianji.petmall.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author liang zai
 * @date 2022/2/18 14:52
 * @description
 */
@Controller
public class SearchController {

    @Autowired
    private MallSearchService mallSearchService;
    @GetMapping("/list.html")
    public String list(SearchParam searchParam, Model model){
        SearchResult searchResult = mallSearchService.seach(searchParam);
        model.addAttribute("seachparam",searchResult);
        return "list";
    }
}
